package qianfeng.com.meijiadaka.viewholder.gnk;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;

import org.xutils.image.ImageOptions;
import org.xutils.x;

import cn.lemon.view.adapter.BaseViewHolder;
import qianfeng.com.meijiadaka.R;
import qianfeng.com.meijiadaka.bean.gnk.GnkBean;

/**
 * Created by yanshihao on 2017/2/10.
 */

public class GnkViewHolder extends BaseViewHolder<GnkBean.ResultBean> {

    private TextView tv1,tv2,tv3;
    private ImageView iv1,iv2;
    public GnkViewHolder(ViewGroup parent) {
        super(parent, R.layout.gnk_item);
    }

    @Override
    public void onInitializeView() {
        super.onInitializeView();
        iv1=findViewById(R.id.gnk_item_iv1);
        iv2 = findViewById(R.id.gnk_item_iv2);
        tv1=findViewById(R.id.gnk_item_title);
        tv2=findViewById(R.id.gnk_item_name);
        tv3=findViewById(R.id.gnk_item_time);
    }

    @Override
    public void setData(GnkBean.ResultBean object) {
        super.setData(object);
        tv1.setText(object.getArticleTitle());
        tv2.setText(object.getNickname());
        tv3.setText(object.getCreateTime());
        Glide.with(itemView.getContext()).load(object.getArticlePicture()).into(iv2);
        ImageOptions options=new ImageOptions.Builder().setCircular(true).
                setLoadingDrawableId(R.mipmap.ic_launcher).build();
        x.image().bind(iv1,object.getAvatar(),options);
    }

    @Override
    public void onItemViewClick(GnkBean.ResultBean object) {
        super.onItemViewClick(object);
    }
}
